# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  
  def use_small_text
    session[:font_size] = 'small'
    redirect_to(params[:url])
  end
  
  def use_large_text
    session[:font_size] = 'large'
    redirect_to(params[:url])
  end
  
  def use_normal_text
    session[:font_size] = nil
    redirect_to(params[:url])
  end

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => 'a142ee24ce432909e2afcbdf0b6a4ff8'

  
  private
  def authorize
    if session[:user_id]
      @current_user = User.find_by_username(session[:user_id]) 
    else
      #login_url = URI.escape("/login?url=" + request.request_uri)
      #puts login_url
      #redirect_to(login_url)
      redirect_to(:controller => "login")
    end
  end
  
  
end
